package web.listner;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

/*
* 监听web服务器开关
* */
public class MyOneListner  implements ServletContextListener {
    @Override
    public void contextInitialized(ServletContextEvent servletContextEvent) {
        int num = 0;
        ServletContext application = servletContextEvent.getServletContext();
        application.setAttribute("onLineNum", num);//初始默认在线人数为0
    }

    @Override
    public void contextDestroyed(ServletContextEvent servletContextEvent) {

    }
}
